package utils;

/**
 * Interfejs koji skladisti konstante.
 * 
 * @author UrosKrkic & Radivoje Popovic
 */
public interface Constants {
	
	public static final String CRLF = "\r\n";
	
	
	public static final String DEFAULT_MULTICAST_ADDRESS = "228.32.125.15";
	
	public static final int DEFAULT_MULTICAST_PORT = 10001;

	
	public static final int CLIENT_SERVER_CONNECTION	= 0;
	public static final int P2P_CONNECTION				= 1;
	
	
	
	public static final String[] COMMAND_NAMES = { 	"REG",
													"LOGIN",
													"CONT_LIST",
													"BLOCK_LIST",
													"CHSTATUS",
													"CHNICK",
													"CHPSWD",
													"CHAVATAR",
													"CHMAIL",
													"LOGOUT",
													"UNREG",
													"DEL",
													"BLOCK",
													"UNBLOCK",
													"ADD",
													"FIND",
													"SEND_MSG",
													"SEND_FILE",
													"ADD_MSGS",
													"CALL_REQUEST" };
	
	
	public static final int COMMAND_COUNT	= 20;
	
	// Command codes
	public static final int REG_CMD			= 0;
	public static final int LOGIN_CMD		= 1;
	public static final int CONT_LIST_CMD	= 2;
	public static final int BLOCK_LIST_CMD	= 3;
	public static final int CHSTATUS_CMD	= 4;
	public static final int CHNICK_CMD		= 5;
	public static final int CHPSWD_CMD		= 6;
	public static final int CHAVATAR_CMD	= 7;
	public static final int CHMAIL_CMD		= 8;
	public static final int LOGOUT_CMD		= 9;
	public static final int UNREG_CMD		= 10;
	public static final int DEL_CMD			= 11;
	public static final int BLOCK_CMD		= 12;
	public static final int UNBLOCK_CMD		= 13;
	public static final int ADD_CMD			= 14;
	public static final int FIND_CMD		= 15;
	public static final int SEND_MSG_CMD	= 16;
	public static final int SEND_FILE_CMD	= 17;
	public static final int ADD_MSGS_CMD	= 18;
	public static final int CALL_REQUEST	= 19;
	
	// koriscen je u klasama ChatDialog i TypingThread - videti _TODO
//	public static final int NO_BUFFERING	= 20;
	
	
	public static final String[] CLIENT_COMMAND_NAMES = { 	"SERV_LOGIN",
															"SERV_LOGOUT",
															"SERV_CHNICK",
															"SERV_CHAVATAR",
															"SERV_CHSTATUS",
															"SERV_CHMAIL",
															"SERV_UNREG",
															"SERV_ADDED",
															"SERV_BLOCK",
															"SERV_UNBLOCK",
															"SERV_DEL",
															"CLIENT_SEND_MSG",
															"SET_SERVER_INFO",
															"PEER_TYPING",
															"SERV_PING",
															"STOP_CALL",
															"PADDING", "PADDING", "PADDING",
															"CALL_REQUEST" };
	
	/*
	 * NAPOMENA:
	 * CALL_REQUEST je bufferovana komanda. Ali posto se klijentske komande kreiraju u odnosu na
	 * CLIENT_COMMAND_NAMES, dodat je PADDING, da bi se popunio prostor do bufferovanog indeksa
	 * za CALL_REQUEST. Pogledati COMMAND_NAMES koji predstavlja bufferovane komande.
	 * Ovo je samo privremeno resenje, u toku debug-a.
	 */
	
	public static final int SERV_LOGIN_CMD		= 0;
	public static final int SERV_LOGOUT_CMD		= 1;
	public static final int SERV_CHNICK			= 2;
	public static final int SERV_CHAVATAR		= 3;
	public static final int SERV_CHSTATUS		= 4;
	public static final int SERV_CHMAIL			= 5;
	public static final int SERV_UNREG			= 6;
	public static final int SERV_ADDED			= 7;
	public static final int SERV_BLOCK			= 8;
	public static final int SERV_UNBLOCK		= 9;
	public static final int SERV_DEL			= 10;
	public static final int CLIENT_SEND_MSG		= 11;
	public static final int SET_SERVER_INFO		= 12;
	public static final int PEER_TYPING			= 13;
	public static final int SERV_PING			= 14;
	public static final int STOP_CALL			= 15;
	
	
	
	// Status codes
	public static final int OFFLINE_STATUS		= 0;
	public static final int ONLINE_STATUS		= 1;
	public static final int BUSY_STATUS			= 2;
	public static final int AWAY_STATUS			= 3;
	public static final int INVISIBLE_STATUS	= 4;
	public static final int BLOCK_STATUS		= 5;
	
	
	public static final String[] STATUS_NAMES = {	"Offline",
													"Online",
													"Busy",
													"Away",
													"Invisible",
													"Block" };
	
	
	public static final String DEFAULT_AVATAR	= "/avatars/avatar01.png";
	
	public static final int INITIAL_STATE 	= 0;
	public static final int LOGGED_STATE	= 1;
	
	public static final int CLIENT_WIDTH	= 290;
	public static final int CLIENT_HEIGHT	= 600;

	
	public static final String CODE_100	= "100 OK";
	public static final String CODE_110	= "110 Loggin OK";		// Nakon komande se salje nickname, pass, email, regdate, awatar <off_messages>
	public static final String CODE_120	= "120 Contact list";	// Broj redova nakon komande
	public static final String CODE_130	= "130 Block list";		// Broj redova nakon komande
	public static final String CODE_210	= "210 Bad username";
	public static final String CODE_220	= "220 User already logged in";
	public static final String CODE_230	= "230 Wrong password";
	
	
	// ALT + 12445
	public static final String LOGOUT_SEQUENCE = "*****";
	
}
